//
//  lxm_fish_hook.h
//
//  Created by xingming on 2021/5/14.
//  Copyright © 2021 xingming. All rights reserved.
//

#ifndef lxm_fish_hook_h
#define lxm_fish_hook_h

#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <objc/objc.h>

#if !defined(FISHHOOK_EXPORT)
#define FISHHOOK_VISIBILITY __attribute__((visibility("hidden")))
#else
#define FISHHOOK_VISIBILITY __attribute__((visibility("default")))
#endif

#ifdef __cplusplus
extern "C" {
#endif //__cplusplus

/*
 * A structure representing a particular intended rebinding from a symbol
 * name to its replacement
 */
struct rebinding {
  const char *name;
  void *replacement;
  void **replaced;
};

/*
 * For each rebinding in rebindings, rebinds references to external, indirect
 * symbols with the specified name to instead point at replacement for each
 * image in the calling process as well as for all future images that are loaded
 * by the process. If rebind_functions is called more than once, the symbols to
 * rebind are added to the existing list of rebindings, and if a given symbol
 * is rebound more than once, the later rebinding will take precedence.
 */
FISHHOOK_VISIBILITY
int lxm_rebind_symbols(struct rebinding rebindings[], size_t rebindings_nel,bool is_cancel);



#ifdef __cplusplus
}
#endif //__cplusplus

#endif //lxm_fish_hook_h
